import Vue from 'vue'
import Router from 'vue-router'
import AppIndex from '../components/index/AppIndex'
import Login from '../components/Login'
import Registered from '../components/Registered'
// import Top from '../components/Top'
// import News from '../components/news/News'
import Pet from '../components/pet/Pet'
import Photography from '../components/photography/Photography'
import Adopt from '../components/adopt/Adopt'
import PersonalCenter from '../components/personalCenter/PersonalCenter'
import SelectData from '../components/selectData/selectData'
import SelectDetail from '../components/selectDetail/selectDetail'
import PetAdd from '../components/pet/PetAdd';
Vue.use(Router)

export default new Router({
  // 去掉请求信息里的#号
  mode: 'history',
  routes: [
    {
      // 登录界面
      path: '/',
      name: 'Login',
      component: Login,
      meta: {
        keepAlive: false // 是否显示导航栏
      }
    },
    // {
    //   // 时事新闻
    //   path: '/news',
    //   name: 'News',
    //   component: News,
    //   meta: {
    //     keepAlive: true,
    //     requireAuth: true
    //   }
    // },
    {
      // 注册界面
      path: '/',
      name: 'Registered',
      component: Registered,
      meta: {
        keepAlive: false // 是否显示导航栏
      }
    },
    {
      // 首页
      path: '/index',
      name: 'AppIndex',
      component: AppIndex,
      meta: {
        keepAlive: true,
        // 阻止页面跳转,登录状态即跳转,否则跳转到登录界面
        requireAuth: true
      }
    },
    {
      // 宠物专题
      path: '/pet',
      name: 'Pet',
      component: Pet,
      meta: {
        // 阻止页面跳转,登录状态即跳转,否则跳转到登录界面
        keepAlive: true,
        requireAuth: true
      }
    },
    {
      // 动物摄影
      path: '/photography',
      name: 'Photography',
      component: Photography,
      meta: {
        // 阻止页面跳转,登录状态即跳转,否则跳转到登录界面
        keepAlive: true,
        requireAuth: true
      }
    },
    {
      // 家宠领养驿站
      path: '/adopt',
      name: 'Adopt',
      component: Adopt,
      meta: {
        // 阻止页面跳转,登录状态即跳转,否则跳转到登录界面
        keepAlive: true,
        requireAuth: true
      }
    },
    {
      // 个人中心
      path: '/personalCenter',
      name: 'PersonalCenter',
      component: PersonalCenter,
      meta: {
        // 阻止页面跳转,登录状态即跳转,否则跳转到登录界面
        keepAlive: true,
        requireAuth: true
      }
    },
    {
      // 搜索页面
      path: '/selectData',
      name: 'SelectData',
      component: SelectData,
      meta: {
        // 阻止页面跳转,登录状态即跳转,否则跳转到登录界面
        keepAlive: false,
        requireAuth: true
      }
    },
    {
      // 搜索详情
      path: '/selectDetail',
      name: 'SelectDetail',
      component: SelectDetail,
      meta: {
        // 阻止页面跳转,登录状态即跳转,否则跳转到登录界面
        keepAlive: false,
        requireAuth: true
      }
    },
    {
      // 宠物课题新增页面
      path: '/pet-add',
      name: 'PET_ADD',
      component: PetAdd,
      meta: {
        // 阻止页面跳转,登录状态即跳转,否则跳转到登录界面
        keepAlive: true,
        requireAuth: true
      }
    }
  ]
})
